package com.tjshop.android.model.tj.json;

import java.io.Serializable;

import org.json.JSONArray;
import org.json.JSONObject;

import com.tjshop.android.model.BaseObject;

public class HomeCategoryItem extends BaseObject implements
		Comparable<HomeCategoryItem>, Serializable {
	private String Id;// "Id":"1",
	private String cat_id;// "cat_id":"3",
	private String cat_name;// "cat_name":"感冒咳嗽",
	private String pic;// "pic":"http://220.178.101.93:8082/images/pic-20150520.png",
	private String npos;// "npos":"1

	public String getId() {
		return Id;
	}

	public void setId(String id) {
		Id = id;
	}

	public String getCat_id() {
		return cat_id;
	}

	public void setCat_id(String cat_id) {
		this.cat_id = cat_id;
	}

	public String getCat_name() {
		return cat_name;
	}

	public void setCat_name(String cat_name) {
		this.cat_name = cat_name;
	}

	public String getPic() {
		return pic;
	}

	public void setPic(String pic) {
		this.pic = pic;
	}

	public String getNpos() {
		return npos;
	}

	public void setNpos(String npos) {
		this.npos = npos;
	}

	@Override
	public void parse(JSONObject data) {
		setId(getString(data, "Id"));
		setCat_id(getString(data, "cid"));
		setCat_name(getString(data, "name"));
		setNpos(getString(data, "npos"));
		setPic(getString(data, "icon"));
	}

	@Override
	public void parse(JSONArray data) {
		// TODO Auto-generated method stub

	}

	@Override
	public int compareTo(HomeCategoryItem arg0) {
		int mypos = Integer.parseInt(npos);
		int otherpos = Integer.parseInt(arg0.getNpos());
		return mypos - otherpos;
	}

}
